home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / wtf < prev    next >
Encoding:
Text File  |  2010-11-16  |  773 b   |  37 lines

  1. # wtf completion
  2. # Raphael Droz, 25/09/2009
  3.  
  4. have wtf &&
  5. _wtf()
  6. {
  7.     local cur prev db
  8.  
  9.     COMPREPLY=()
  10.     _get_comp_words_by_ref cur prev
  11.  
  12.     [ "$prev" = -f ] && _filedir && return 0
  13.     [[ "$cur" == -* ]] && COMPREPLY=( -f ) && return 0
  14.  
  15.     set -- "${COMP_WORDS[@]}"
  16.     while [ $# -gt 0 ]; do
  17.         if [ "$1" = -f ]; then
  18.             shift ; db=$1 ; break
  19.         fi
  20.         shift
  21.     done
  22.     [ -z $db ] && db=${ACRONYMDB:-/usr/share/misc/acronyms*}
  23.  
  24.     [ ${BASH_VERSINFO[0]} -ge 4 ] && cur="${cur^^}"
  25.  
  26.     COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur}" ) )
  27. } &&
  28. complete -F _wtf -o filenames wtf
  29.  
  30. # Local variables:
  31. # mode: shell-script
  32. # sh-basic-offset: 4
  33. # sh-indent-comment: t
  34. # indent-tabs-mode: nil
  35. # End:
  36. # ex: ts=4 sw=4 et filetype=sh
  37.